﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.ComponentModel;

namespace WaterRevenueMS.Componnent.Common
{
    public class OperationResult
    {
        public OperationResult(OperationResultType resultType)
        {
            ResultType = resultType;
        }

        public OperationResult(OperationResultType resultType, string message)
            : this(resultType)
        {
            Message = message;
        }

        public OperationResult(OperationResultType resultType, string message, object appendData)
            : this(resultType, message)
        {
            AppendData = appendData;
        }

        public OperationResult(OperationResultType resultType, string message, string logMessage)
            : this(resultType, message)
        {
            LogMessage = logMessage;
        }

        public OperationResult(OperationResultType resultType, string message, string logMessage, object appendData)
            : this(resultType, message, logMessage)
        {
            AppendData = appendData;
        }

        public OperationResultType ResultType { get; set; }

        public string Message { get; set; }

        public string LogMessage { get; set; }

        public object AppendData { get; set; }
    }

    [Description("业务操作结果的枚举")]
    public enum OperationResultType
    {
        [Description("操作成功")]
        Success,

        [Description("操作没有引起任何变化,提交取消。")]
        NoChanged,

        [Description("参数错误")]
        ParamError,

        [Description("指定参数的数据不存在")]
        QueryNull,

        [Description("当前用户权限不足,不能继续操作")]
        PurviewLack,

        [Description("非法操作")]
        IllegaOperation,

        [Description("警告")]
        Warning,

        [Description("操作引发错误.")]
        Error
    }
}
